package com.sg.service.biz.app.nb;

import com.sg.common.util.CommonFunctionHelper;
import com.sg.dto.biz.app.req.CalculateCaluDateDiffReqDto;
import com.sg.dto.biz.app.res.CalculateCaluDateDiffRespDto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

/**
 * @author ： 手工接入方法
 * @version 1.0
 * @since 2022/5/28 15:32
 */
@Service
public class NbCalculationRules {
    /**
     * code:caluTimeDiff
     * name:M3-计算时间相减得偏差
     * desc:undefined
     * gen by moon at 8/28/2022, 4:07:17 PM
     **/
    @Trace(operationName = "M3-计算时间相减得偏差")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public CalculateCaluDateDiffRespDto calculateCaluDateDiff(CalculateCaluDateDiffReqDto reqDto) {
        CalculateCaluDateDiffRespDto retData = new CalculateCaluDateDiffRespDto();
        int days = CommonFunctionHelper.differentDaysByString(reqDto.getCaluEndTime(), reqDto.getCaluStartTime());
        retData.setTimeDiffDays(String.valueOf(days));
        retData.setTimeDiffHours(String.valueOf(days * 24));
        return retData;
    }
    //手工接入方法
}
